﻿@model Tippelde.Web.Models.News.CreateNewsModel
@{
    ViewBag.Title = "Esemény létrehozása";
    string actionName = ViewBag.Action;
}

<div class="row">
    <div class="col-lg-12">
        <div class="well">
            @using (Html.BeginForm(actionName, "News", FormMethod.Post, new { @class = "form-vertical" }))
            {
                @Html.ValidationSummary();
                @Html.AntiForgeryToken();
                <fieldset>
                    @Html.HiddenFor(m => m.Id)
                    <legend class="modalTitle">Hír @(actionName == "Edit" ? "módosítása" : "hozzáadása")</legend>
                    <div class="col-lg-6">
                        <div class="form-group">
                            <div class="col-lg-12">
                                @Html.TextBoxFor(m => m.Title, new { @class = "form-control", placeholder = "Cím" })
                            </div>
                        </div>

                        <div class="form-group">
                            @Html.LabelFor(m => m.Content, new { @class = "control-label" })
                            <div class="col-lg-12">
                                @Html.TextAreaFor(m => m.Content, new { @class = "form-control text-editor-input", rows = "10" })
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-lg-9 col-lg-offset-3">
                                <button type="submit" class="btn btn-primary">Mentés</button>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6">
                        @if (User.IsInRole("newsmanager"))
                        {
                            <div class="form-group">
                                <div class="form-control">


                                    @Html.CheckBoxFor(m => m.AllowAnonym, new { @class = "" })
                                    @Html.LabelFor(m => m.AllowAnonym, new { @class = "" })
                                </div>

                                <div class="form-control">


                                    @Html.CheckBoxFor(m => m.AllowGlobalAuthenticated, new { @class = "" })
                                    @Html.LabelFor(m => m.AllowGlobalAuthenticated, new { @class = "" })
                                </div>
                            </div>
                        }
                        <div class="form-group">
                            @Html.LabelFor(m => m.Groups, new { @class = "control-label" })
                            @{ Html.RenderPartial("_GroupSelector", Model.GroupList, new ViewDataDictionary { { "ModelName", "Groups" } }); }
                        </div>
                    </div>
                </fieldset>
            }
        </div>
    </div>
</div>
@section scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("/Scripts/tinymce/tinymce.min.js")
    @Scripts.Render("/Scripts/tinymce/jquery.tinymce.min.js")
    @Scripts.Render("~/bundles/tippelde-texteditor")
    <script>
        Tippelde.InitTextEditor(".text-editor-input", 500);
    </script>
}